var major = {
    name: "da",
    age: 23,
};
var App;
(function (App) {
    var app = {
        name: "sachin",
        age: 23,
    };
})(App || (App = {}));
// ，命名空间不允许同名的导出
// namespace A {
//     export type lao = string
// }
//
//  namespace A {
//     export type lao = string
// }
// 命名空间与类的导出  类在命名空间前   类中的函数会挂在到prototype中   命名空间被挂载到构造函数上成为静态成员
var bbPerson = /** @class */ (function () {
    function bbPerson() {
    }
    bbPerson.prototype.hi = function () {
        console.log('hellow');
    };
    return bbPerson;
}());
(function (bbPerson) {
    bbPerson.dfdskjkj = 'sachin';
    function getAage() {
        return 23;
    }
    bbPerson.getAage = getAage;
})(bbPerson || (bbPerson = {}));
var psda = new bbPerson();
console.dir(psda);
var Pp = /** @class */ (function () {
    function Pp(age, uname) {
        this.age = age;
    }
    Pp.getName = function () {
        return Pp.uname;
    };
    Pp.prototype.getAge = function () {
        return this.age;
    };
    return Pp;
}());
var zksse = new Pp(23, 'sachin');
console.dir(zksse);
var cce; //访问该类的静态属性
var dde; //访问该类的实例属性
dde.getAge();
cce.getName();
// 命名空间与函数 可以使用命名空间的参数
function zz2() {
    zz.countSpace++;
    console.log(zz.countSpace);
}
(function (zz2) {
    zz2.countSpace = 0;
})(zz2 || (zz2 = {}));
zz2();
// 命名空间和枚举 合并
var Colosr;
(function (Colosr) {
    Colosr[Colosr["red"] = 0] = "red";
    Colosr[Colosr["blue"] = 1] = "blue";
})(Colosr || (Colosr = {}));
(function (Colosr) {
    Colosr.yellow = 3;
})(Colosr || (Colosr = {}));
console.log(Colosr.yellow);
// 命名空间嵌套
(function (App) {
    var Services;
    (function (Services) {
        function getUser() {
            return { id: 1, name: "张三" };
        }
        Services.getUser = getUser;
    })(Services = App.Services || (App.Services = {}));
})(App || (App = {}));
// 使用 Models.User 类型声明一个变量
var user = {
    id: 123,
    name: "李四",
};
// 调用 Services 里的函数获取 User 对象
var fetchedUser = App.Services.getUser();
console.log(fetchedUser.id, fetchedUser.name); // 输出：1 张三
